<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ include file="/pages/jsp/internal/include.jsp" %>

<div class="inner_cont" > 
	<h2><fmt:message key="label.galleryRelatedList"/></h2>
	
	<span class="note">
	
		<fmt:message key="page.relateUser.description"/>
		
		<c:forEach items="${model.messages}" var="message">
			<div id="message"><fmt:message key="${message}"/></div>
		</c:forEach>
		
		<c:forEach items="${model.errors}" var="error">
			<div id="error">
				<fmt:message key="${error.key}">
					<fmt:param value="${error.param1}"/>
				</fmt:message>
			</div>
		</c:forEach>
	</span>
	<!-- GALLERY DA ASSOCIARE -->
	
	<c:if test="${not empty model.galleries}">
	
		<form  id="manageGalleryForm" method="post" class="form">
		
			<input type="hidden" name="contentId" value="<c:out value="${model.contentId}"/>"/>
			
			<table id="tableRelateGallery" class="tableDati col tablesorter" >
				<thead>
					<tr>
						<th ><fmt:message key="th.id"/></th>
			   			<th ><fmt:message key="th.titolo"/></th>
			   			<th ><fmt:message key="th.strillo"/></th>
						<th ><fmt:message key="th.desc"/></th>
						
			   		</tr>
			   	</thead>
			   	<tfoot>
			   		<tr>
						<th ><fmt:message key="th.id"/></th>
			   			<th ><fmt:message key="th.titolo"/></th>
			   			<th ><fmt:message key="th.strillo"/></th>
						<th ><fmt:message key="th.desc"/></th>
			   		</tr>
			   	</tfoot>
			   	
			   	<tbody>
					<c:forEach items="${model.galleries}" var="content" varStatus="i">
						<tr>
							<td style="text-align:center"> <input type="checkbox" name="galleryId" value="<c:out value="${content.id}"/>"> </td>
					   		<td> <c:out value="${content.titolo}"/> </td>
							<td><c:out value="${content.strillo}"/></td>
							<td><c:out value="${content.descrizione}" escapeXml="false"/></td>
					   	</tr>
					 </c:forEach>
				 </tbody>
			</table>
			
			<div  id="pagerUser" style="position:relative;top:0px">
				<form>
					<img src="<c:url value="/js/table/first.png"/>" class="first"/>
					<img src="<c:url value="/js/table/prev.png"/>" class="prev"/>
					<input type="text" class="pagedisplay"/>
					<img src="<c:url value="/js/table/next.png"/>" class="next"/>
					<img src="<c:url value="/js/table/last.png"/>" class="last"/>
					<select class="pagesize">
						<option selected="selected" value="5">5</option>
						<option  value="10">10</option>
						<option value="20">20</option>
						<option value="30">30</option>
						<option value="40">40</option>
					</select>
				</form> 
			</div>
			
			<br/>
			
			<div class="action_bar">
				<input type="button" class ="puls" value="Associa" onclick="sendFormForAction('<c:url value="/content/manageRelationGallery.htm"/>','manageGalleryForm','hasGalleryDiv','createRelation');"/>
			</div>
		</form>
	</c:if>
</div>
	
<div class="inner_cont" > 	
	<!-- GALLERY ASSOCIATE -->
	
	<c:if test="${not empty model.relatedGalleries}">
	
		<h2><fmt:message key="label.galleryRelatedToContent"/></h2>
		
		<form  id="manageGalleryRelatedForm" method="post">
			<input type="hidden" name="contentId" value="<c:out value="${model.contentId}"/>"/>
			
			<table id="tableRelatedGallery" class="tableDati col tablesorter">
				<thead>
					<tr>
						<th ><fmt:message key="th.id"/></th>
			   			<th ><fmt:message key="th.titolo"/></th>
			   			<th ><fmt:message key="th.strillo"/></th>
						<th ><fmt:message key="th.desc"/></th>
						
			   		</tr>
			   	</thead>
			   	<tfoot>
			   		<tr>
						<th ><fmt:message key="th.id"/></th>
			   			<th ><fmt:message key="th.titolo"/></th>
			   			<th ><fmt:message key="th.strillo"/></th>
						<th ><fmt:message key="th.desc"/></th>
			   		</tr>
			   	</tfoot>
			   	
			   <tbody>
					<c:forEach items="${model.relatedGalleries}" var="content" varStatus="i">
						<tr>
							<td style="text-align:center"> <input type="checkbox" name="galleryId" value="<c:out value="${content.id}"/>"> </td>
					   		<td> <c:out value="${content.titolo}"/> </td>
							<td><c:out value="${content.strillo}"/></td>
							<td><c:out value="${content.descrizione}" escapeXml="false"/></td>
					   	</tr>
					 </c:forEach>
				</tbody>
				
			</table>
			<div  id="pagerUserAssociated" style="position:relative;top:0px">
				<form>
					<img src="<c:url value="/js/table/first.png"/>" class="first"/>
					<img src="<c:url value="/js/table/prev.png"/>" class="prev"/>
					<input type="text" class="pagedisplay"/>
					<img src="<c:url value="/js/table/next.png"/>" class="next"/>
					<img src="<c:url value="/js/table/last.png"/>" class="last"/>
					<select class="pagesize">
						<option selected="selected" value="10">10</option>
						<option value="20">20</option>
						<option value="30">30</option>
						<option value="40">40</option>
					</select>
				</form> 
			</div>
			<br/>
			<div class="action_bar">
				<input type="button" class="puls" value="Elimina Associazione" onclick="sendFormForAction('<c:url value="/content/manageRelationGallery.htm"/>','manageGalleryRelatedForm','hasGalleryDiv','deleteRelation');"/>
			</div>
		</form>
	</c:if>
</div>

<script>
$(document).ready(function() { 
	$("#tableRelateGallery").tablesorter({widthFixed: true}).tablesorterPager({container: $("#pagerGallery"),size:'5'}); 
	$("#tableRelatedGallery").tablesorter({widthFixed: true}).tablesorterPager({container: $("#pagerGalleryRelated"),size:'5'});
});

</script>
